package com.kaifamiao.dispatch;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Logger;

@WebServlet( "/wang/yu/yan" )
public class WangYuYanServlet extends HttpServlet {

    private Logger logger = Logger.getLogger( this.getClass().getName() );

    @Override
    protected void service( HttpServletRequest request , HttpServletResponse response )
            throws ServletException, IOException {
        logger.info( "我是王语嫣" );

        logger.info( "id: " + request.getAttribute( "id" ) );
        logger.info( "name: " + request.getAttribute( "name" ) );

        response.setCharacterEncoding( "UTF-8" );
        response.setContentType( "text/html;charset=UTF-8" );
        PrintWriter out = response.getWriter();
        out.println( "<h1>好的，我王语嫣答应你</h1>" );

    }

}
